<?php
/*
 * Created on 22.04.2008
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 class Model_Binarymask extends Models_Base {
 	
	function getList() {
		return $this->MASK;
	}
	
	function getListByMask($mask) {
		
		$out = array();
		
		foreach ($this->getList() as $m) {
		
			if($mask & 1 << $i )
				$out[] = $m;
			$i++;
		}
		
		return $out;
	} 
	
	function getStringByMask($mask) {
		
		$out = array();
		
		foreach ($this->getList() as $m) {
		
			if($mask & 1 << $i )
				$out[] = $m[description];
			$i++;
		}
		
		return join(', ',$out);
	} 
	
	function getMaskByList($list) {
		foreach($this->MASK as $m) {
			
			foreach($list as $l) {
				
				if($l == $m[id] ) {
					$mask = $mask | 1 << $i;
				}
			}
			$i++;
		}

		return $mask;
	}
	
		
 }
?>
